home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / comm1 / supertgs.lha / STAGS.LHA / supertags / AMaint next >
Text File  |  1996-05-07  |  5KB  |  47 lines

  1. /**************************************************************************\
  2.            $VER: SuperTags AMaint, v2.11 (7-May-96) by Dotoran!
  3. \**************************************************************************/
  4. options results;signal on SYNTAX;signal on ERROR;signal on IOERR;tr=transmit
  5. se=sendstring;gu=getuser;changewhere "SuperTagsAMaint";ver="v2.11"
  6. /**************************************************************************~
  7.  * This file looks for the existence of files ending in ".new" in your    *
  8.  * specified TagData/ directory. If any are found, they are read in, then *
  9.  * appended to the corresponding data file. The data file is then sorted, *
  10.  * dupe checked, and a new index file will be created. The ".new" file is *
  11.  * then deleted from the directory.  If no ".new" files are found, the    *
  12.  * file simply exits with no work to do. Whatever DOES happen is noted in *
  13.  * either your "calls" log, or your "ARexx_Says" log, if you have one.    *
  14. \**************************************************************************/
  15. if ~exists("pfiles:SuperTags.cfg") then do;a="cfSuperTags c9NOT caConfigured!";logentry a;tr a;exit;end
  16. call open(f1,"pfiles:SuperTags.cfg","r");a=readln(f1);parse var a cver""j;dfp=readln(f1);dfd=readln(f1);call close(f1)
  17. if ver~=cver then do;a="c9Wrong SuperTags Config Version!";tr a;logentry a;exit;end
  18. if sc=1 then do;a="c9SuperTags Temporarily Disabled";tr a;logentry a;exit;end
  19. list.="";nlist.="";nlists=0;if ~exists(dfp"TagLines") then do;a="No tag lists created; SuperTags automaint finished!";tr a;logentry a;exit;end
  20. call open(f1,dfp"TagLines","r");do i=1 until eof(f1);list.i=readln(f1);parse var list.i fn.i""ln.i""ag.i""ge.i""ya.i""um.i""nf.i""j;end i;call close(f1);lists=i-1
  21. do i=1 to lists;if exists(dfd||fn.i".new") then do;nlists=nlists+1;nlist.nlists=fn.i;end;end i
  22. if nlists=0 then do;a="No new tags to process; SuperTags automaint finished!";tr a;logentry a;exit;end
  23. a="SuperTags automaint started";tr a;tr;logentry a;do ii=1 to nlists;se "@4Reading new tags from `"nlist.ii".new'..."
  24. call open(f1,dfd||nlist.ii".new","r");do ij=1 until eof(f1);ntag.ij=readln(f1);end ij;ntags=ij-1;call close(f1);tr "done."
  25. se "Appending them to `"nlist.ii"' list...";call open(f1,dfd||nlist.ii,"a");do ij=1 to ntags;call writeln(f1,ntag.ij);end ij;call close(f1);tr "done."
  26. call open(f1,dfd||nlist.ii".ndx2","r");oldtags=c2d(readch(f1,2),2);nexttag=c2d(readch(f1,2),2);call close(f1)
  27. call SORTLIST(nlist.ii);call DUPECHECK(nlist.ii);call MAKEINDEX(nlist.ii);call MAKEDATA(nlist.ii);new=tags-oldtags
  28. if new>0 then do;a="SuperTags added "new" new tagline(s) to `"nlist.ii"' listing!";tr a;logentry a;end
  29. se "Deleting... `"nlist.ii".new' file...";address command "delete "dfd||nlist.ii".new";tr "done.n1";end ii
  30. a="SuperTags automaint completed!";tr a;logentry a;exit
  31. SORTLIST:;parse arg f;se "Sorting.... `"f"' text file...";address command "sort "dfd||f" "dfd||f;tr "done.";return
  32. DUPECHECK:;parse arg f;se "Checking... `"f"' text file for dupes...";call open(f1,dfd||f,'r');a=1;c=1;tag.=""
  33. do until eof(f1);b=a-1;tag.a=readln(f1);c=c+1;t1=upper(compress(tag.a," `~!@#$%^&*()-_=+\|[{]};:',<.>/?"||d2c(34)))
  34. t2=upper(compress(tag.b," `~!@#$%^&*()-_=+\|[{]};:',<.>/?"||d2c(34)));if t1~=t2 then a=a+1;end;tags=a-2;tags2=c-2
  35. call close(f1);tr tags2-tags" dupe(s) found.";return
  36. MAKEINDEX:;parse arg f;se "Creating... `"f".ndx2' index file...";st=1;se "s";in.1=1;do i=1 to 26;do j=st to tags
  37. se "["d2c(i+64)"/"j"]u";a=c2d(left(tag.j,1));if a<65 then iterate j;if a=i+64 then do;in.i=j;st=j;leave j;end;end j;k=i+1;in.k=st;end i
  38. pos=0;do i=1 to tags;se "["tags-i"]u";ind.i=pos;pos=pos+length(tag.i)+1;end i
  39. se "done.n1Writing.... `"f".ndx2' index file...";call open(f1,dfd||f'.ndx2','w');call writech(f1,d2c(tags,2));call writech(f1,d2c(nexttag,2))
  40. do i=1 to 26;call writech(f1,d2c(in.i,2));end i;do i=1 to tags;call writech(f1,d2c(ind.i,3));end i;call close(f1);tr "done.";return
  41. MAKEDATA:;parse arg f;old="";se "Saving..... `"f"' tagline file...";call open(f1,dfd||f,'w');do i=1 to tags;call writeln(f1,tag.i);end i;call close(f1);tr tags" total.";return
  42. SYNTAX:;ERROR:;IOERR:;e1=' c9Errorcf: ca'rc' cf(ca'errortext(rc)'cf)';e2='  c9Linecf: ce'left(sigl,4)'c9Filecf:'
  43. gu 1311992;a=result;gu 1311960;b=result;c='cb"ce'a||b'cb"';e2=e2' 'c;tr e1;tr e2;logentry e1;logentry e2;e=sourceline(sigl)
  44. do while e~='';e3='c9Sourcecf: cd'left(e,37);tr e3;logentry e3;e=substr(e,38);end;bufferflush;exit
  45. /** Last Edited: 7-May-96 *************************************************\
  46. \****************************************** FRONTIERS BBS (716)/823-9892 **/
  47.